import java.util.Scanner;

// Circle 类，表示圆形对象
class Circle {
    private double radius; // 圆形半径

    // 构造方法：初始化半径为指定值
    public Circle(double radius) {
        this.radius = radius;
    }

    // 构造方法：默认初始化半径为 0
    public Circle() {
        this.radius = 0;
    }

    // 设置半径
    public void setRadius(double radius) {
        this.radius = radius;
    }

    // 获取半径
    public double getRadius() {
        return radius;
    }

    // 计算圆形的面积
    public double getArea() {
        return Math.PI * radius * radius;
    }

    // 计算圆形的周长
    public double getPerimeter() {
        return 2 * Math.PI * radius;
    }

    // 转换为字符串形式
    @Override
    public String toString() {
        return "Circle(r:" + radius + ")";
    }
}

// Cylinder 类，表示圆柱体对象
class Cylinder {
    private double height; // 圆柱体高度
    private Circle circle; // 圆柱体底面的圆形

    // 构造方法：初始化高度和底面圆形
    public Cylinder(double height, Circle circle) {
        this.height = height;
        this.circle = circle;
    }

    // 构造方法：默认初始化高度为 0，底面圆形为半径为 0 的圆形
    public Cylinder() {
        this.height = 0;
        this.circle = new Circle();
    }

    // 设置高度
    public void setHeight(double height) {
        this.height = height;
    }

    // 获取高度
    public double getHeight() {
        return height;
    }

    // 设置底面圆形
    public void setCircle(Circle circle) {
        this.circle = circle;
    }

    // 获取底面圆形
    public Circle getCircle() {
        return circle;
    }

    // 计算圆柱体的表面积
    public double getArea() {
        double baseArea = 2 * circle.getArea(); // 两个底面的面积
        double sideArea = circle.getPerimeter() * height; // 侧面的面积
        return baseArea + sideArea;
    }

    // 计算圆柱体的体积
    public double getVolume() {
        return circle.getArea() * height;
    }

    // 转换为字符串形式
    @Override
    public String toString() {
        return "Cylinder(h:" + height + "," + circle.toString() + ")";
    }
}

// 主类 Main
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(); // 输入几何图形的数量

        for (int i = 0; i < n; i++) {
            String str = input.next(); // 输入几何图形的类型
            if (str.equals("Circle")) {
                // 创建圆形对象
                Circle c = new Circle(input.nextDouble());
                System.out.println("The area of " + c.toString() + " is " + String.format("%.2f", c.getArea()));
                System.out.println("The perimeterof " + c.toString() + " is " + String.format("%.2f", c.getPerimeter()));
            } else if (str.equals("Cylinder")) {
                // 创建圆柱体对象
                double height = input.nextDouble();
                Circle circle = new Circle(input.nextDouble());
                Cylinder r = new Cylinder(height, circle);
                System.out.println("The area of " + r.toString() + " is " + String.format("%.2f", r.getArea()));
                System.out.println("The volume of " + r.toString() + " is " + String.format("%.2f", r.getVolume()));
            }
        }
    }
}